package com.sinosoft.hydra.um.repositories.common;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2015/8/19.
 */
public class MyJdbcTemplate extends JdbcTemplate {


    public List<Map<String, Object>> queryForList(String sql) throws DataAccessException {
        List<Map<String, Object>> maps = super.queryForList(sql);
        for(Map<String, Object> map : maps){
            for(java.util.Map.Entry<String,Object> entry : map.entrySet()){
                if(entry.getValue() == null){
                    entry.setValue("");
                }
            }
        }
        return maps;
    }
}
